﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core;
using COFE.Core.Profile;
using COFE.Core.Utils;

namespace COFE.Core.Lister
{
    public class ProfileRootDirectoryLister : PrimaryDirectoryListerBase  
    {
        public const string ProfileRootFactoryKey = "ProfileRoot";
        public const string ProfileRootListerKey = "COFE_PROFILEROOT";
        public const string ProfileRootParsablePath = "{COFE_PROFILEROOT}";
        #region Constructor

        public ProfileRootDirectoryLister(IFactory<IDirectoryLister> factory, string listerKey)
            : base(factory, ProfileRootListerKey)
        {
            ListerKey = listerKey;

            _list = (item, flags) => {return COFEShared.CurrentUserProfile.Volumes.RootDirectories; };

            _parse = (path, flags) =>
            {
                if (path == "")
                    return COFEShared.EntryConstructor.CreateDirectory(this.ListerKey, 
                        new ProfileRootPropertyProvider(), flags);
                return null;
            };

            _getParent = (entry) => { return null; };   
        }

        #endregion


        #region Methods

        public override IDirectoryController CreateController()
        {
            return NullDirectoryController.Create(this);
        }

        public override IStreamProvider CreateStreamProvider()
        {
            return NullStreamProvider.Create(this);
        }

        #endregion

        #region Data


        #endregion

        #region Public Properties



        #endregion
        
    }
}
